import http from '@/utils/http'

export function articleApi(data, params) {
  return http.request({
    url: '/api/article/getAll',
    method: 'POST',
    data,
    params
  })
}

export function articleDeleteApi(_id) {
  return http.request({
    url: `/api/article/${_id}`,
    method: 'DELETE',
  })
}

export function articleDetailNoTokenApi(data) {
  return http.request({
    url: `/api/article/getDetail`,
    method: 'POST',
    data
  })
}

export function articleDetailApi(_id) {
  return http.request({
    url: `/api/article/${_id}`,
    method: 'GET',
  })
}

export function articleAddApi(data) {
  return http.request({
    url: `/api/article`,
    method: 'POST',
    data,
  })
}

export function articleUpsertApi(data) {
  return http.request({
    url: `/api/article/${data?.id}`,
    method: 'PUT',
    data,
  })
}